#include <iostream>


/**
 * 
 * 时间复杂度：O((m-n+1)*logm)
 * 空间复杂度：O(1)
 * 
 * 奖券数目
 * 
 */
using namespace std;
int main(){
    int n, m, sum = 0;
    cin >> n >> m;
    for (int i = n; i <= m; i++)
    {
        int x = i, flag = 0;
        while (x > 0)
        {
            if (x % 10 == 4)
            {
                flag = 1;
                break;
            }
            x /= 10;
        }
        if (flag == 0)
        {
            sum++;
        }
    }
    cout << sum;
}
